package gxdlxy.zx2202.game.union;

import gxdlxy.zx2202.game.Hero;

class Person extends Hero {
    protected int atk, def;
    public int getDef(){
        return this.def;
    }
    public void setDef(int def){
        if(def > 1000)
            this.def = 100;
        this.def = def;
    }
}
class Priest extends Person{
    public static void main(String[] args) {
        Person 张三 = new Person();
        System.out.println(张三.atk);
        // 直接修改，存在安全隐患
        张三.def = 1000000;
    }
}
